//
//  KOFYViewController.m
//  KOFY
//
//  Created by Warren Holybee on 12/1/10.
//  Copyright 2010 Warren Holybee. All rights reserved.
//
// Simple View that create an XMLReader to Parse BIM data
// and passes that to other views as needed when the button is pushed

#import "KOFYViewController.h"
#import "XMLReader.h"
#import "VoteView.h"
#import "TwitterView.h"
#import "CommentView.h"
#import "DogView.h"
#import "CKMTViewController.h"
#import "titanView.h"

@implementation KOFYViewController


- (void)dealloc {
	[xml release];
    [super dealloc];
}



// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
		
		
        // Custom initialization
    }
    return self;
}


/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	xml = [[XMLReader alloc] init];
[xml initWithURL:@"http://video.kofytv.com/iphone.xml"];
	
	//	[xml createFakeData]; // until xmlreader is done.
	
}



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}




#pragma mark button IBActions

-(IBAction)voteButton: (id) sender {
	VoteView *nextView = [[VoteView alloc] initWithNibName:@"VoteView" bundle:nil];
	nextView.survey = xml.survey;
	[self presentModalViewController:nextView animated:NO ];
	
}

-(IBAction)clubButton: (id) sender {
	CKMTViewController *nextView = [[CKMTViewController alloc] initWithNibName:@"CKMTViewController" bundle:nil];
	
	[self presentModalViewController:nextView animated:NO ];
}


-(IBAction)twitterButton: (id) sender {

	TwitterView *nextView = [[TwitterView alloc] initWithNibName:@"TwitterView" bundle:nil];
	nextView.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
	self.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:nextView animated:NO ];
	
	
}
-(IBAction)dogsButton: (id) sender {
	DogView *nextView = [[DogView alloc] initWithNibName:@"DogView" bundle:nil];
	
	[self presentModalViewController:nextView animated:NO ];
	
}


-(IBAction)commentButton: (id) sender {
	CommentView *nextView = [[CommentView alloc] initWithNibName:@"CommentView" bundle:nil];

	[self presentModalViewController:nextView animated:NO ];
}


-(IBAction)gridButton: (id) sender {
	titanView *nextView = [[titanView alloc] initWithNibName:@"titanView" bundle:nil];
	
	[self presentModalViewController:nextView animated:NO ];
}


@end
